#pragma once

#include "stdafx.h"
#include "resource.h"

#define WM_APP_TRAYCALLBACK (WM_APP + 1)

class CAppResources
{
private:
    LPTSTR m_lpAppTitle;
    LPTSTR m_lpStartQuestion;
    HMENU m_hTrayMenu;
private:
    void Initialize();
public:
    CAppResources();
    LPTSTR GetAppTitle() { return m_lpAppTitle; }
    LPTSTR GetStartQuestion() { return m_lpStartQuestion; }
    HMENU GetTrayMenu() { return m_hTrayMenu; }
};

class CAppMutex
{
private:
    BOOL m_Success;
    HANDLE m_hAppMutex;
private:
    void Initialize();
    void Cleanup();
public:
    CAppMutex();
    ~CAppMutex();
    BOOL Success() { return m_Success; }
};

class CTrayIcon
{
private:
    BOOL m_Success;
    HWND m_hWnd;
private:
    void Initialize();
    void Cleanup();
public:
    CTrayIcon(HWND);
    ~CTrayIcon();
    BOOL Success() { return m_Success; }
};

class CApp
{
private:
    BOOL m_Success;
    CAppMutex* m_cAppMutex;
    HWND m_hWnd;
    CTrayIcon* m_cTrayIcon;
private:
    void Initialize();
    void Cleanup();
    ATOM MyRegisterClass();
    HWND MyCreateWindow();
public:
    CApp();
    ~CApp();
    BOOL Success() { return m_Success; }
};

class CAppStartup
{
public:
    static BOOL DoesAppStartsWhenWindowsStarts();
    static void SetAppStartsWhenWindowsStarts();
};

extern HINSTANCE g_hInst;
extern CAppResources* g_cAppResources;

LRESULT CALLBACK AppWndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK AboutDlgProc(HWND, UINT, WPARAM, LPARAM);
